﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="biz_dlg_role" Codefile="dlg_role.aspx.cs" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>用户角色管理</title>

    <script type="text/javascript">
    var LOCID_DEVERROR_BADTYPE_PICKLIST = "\u6b64\u63a7\u4ef6\u53ea\u63a5\u53d7\u5b57\u7b26\u4e32\u3001\u6574\u6570\u6216\u7a7a\u8f93\u5165\u3002";
    var LOCID_SELECTBOX_BUTTON_ALT = "\u663e\u793a\u9009\u9879\u5217\u8868";
    var LOCID_FORM_REQUIRED_BKG_COLOR = "";
    var LOCID_FORM_REQUIRED_ALT = "\u5fc5\u9700";
    var LOCID_COPY_SHORTCUT_ERROR = "\u65e0\u6cd5\u5c06\u6b64\u5feb\u6377\u65b9\u5f0f\u590d\u5236\u5230\u526a\u8d34\u677f\u3002";
    var LOCID_UI_DIR = "LTR";
    var LOCID_AM_DESIGNATOR = "\u4e0a\u5348";
    var LOCID_PM_DESIGNATOR = "\u4e0b\u5348";
    var LOCID_FIRST_WEEK_SELECT = "FirstDay";
    var LOCID_UNRECOGNIZE_DOTC = "\x7b0\x7d \u4e0d\u662f\u53ef\u8bc6\u522b\u7684\u5bf9\u8c61\u7c7b\u578b\u3002";
    var LOCID_XML_PROCESS_ERROR = "\u5904\u7406\u60a8\u7684\u8bf7\u6c42\u65f6\u51fa\u9519\u3002\u8bf7\u7a0d\u5019\u518d\u91cd\u8bd5\u3002";
    var LOCID_POPUP_BLOCKER_ERROR = "金蟾•展会CRM \u7a97\u53e3\u65e0\u6cd5\u6253\u5f00\uff0c\u53ef\u80fd\u5df2\u88ab\u5f39\u51fa\u7a97\u53e3\u963b\u6b62\u7a0b\u5e8f\u6240\u963b\u6b62\u3002\u8bf7\u5c06\u8fd9\u53f0 金蟾•展会CRM \u670d\u52a1\u5668\u6dfb\u52a0\u5230\u60a8\u7684\u5f39\u51fa\u7a97\u53e3\u963b\u6b62\u7a0b\u5e8f\u5141\u8bb8\u6253\u5f00\u65b0\u7a97\u53e3\u7684\u7ad9\u70b9\u7684\u5217\u8868\u4e2d\x3a";
    var LOCID_BU_CANNOTDISABLE = "\u5df2\u68c0\u6d4b\u5230\u6b64\u64cd\u4f5c\u5c06\u505c\u7528\u6240\u6709\u5269\u4f59\u7684\u4e1a\u52a1\u90e8\u95e8\uff0c\u56e0\u6b64\u65e0\u6cd5\u7ee7\u7eed\u3002";
    var LOCID_DIALOG_OFFSET_WIDTH = "0";
    var LOCID_DIALOG_OFFSET_HEIGHT = "0";
    var LOCID_ERROR_DIALOG_WIDTH = "550";
    var LOCID_ERROR_DIALOG_HEIGHT = "260";
    var LOCID_CONTRACTS_TDIALOG_WIDTH = "350";
    var LOCID_CONTRACTS_TDIALOG_HEIGHT = "350";
    var LOCID_FORMS_SAVE_CONFIRM_TITLE = "\u5c1a\u672a\u4fdd\u5b58\u6240\u505a\u7684\u66f4\u6539\u3002\u8981\u505c\u7559\u5728\u8be5\u9875\u9762\u4e0a\uff0c\u4ee5\u4fbf\u4fdd\u5b58\u6240\u505a\u7684\u66f4\u6539\uff0c\u8bf7\u5355\u51fb\u201c\u53d6\u6d88\u201d\u3002";
    var LOCID_FORM_PROIVE_VALUE_MASK = "\u5fc5\u987b\u63d0\u4f9b\x7b0\x7d\u7684\u503c\u3002";
    var LOCID_FORM_PRINT_DIRTY_MESSAGE = "\u6b64\u8868\u5355\u5df2\u66f4\u6539\uff0c\u6253\u5370\u4e4b\u524d\u5fc5\u987b\u8fdb\u884c\u4fdd\u5b58\u3002";
    var LOCID_REMOTECOMMAND_ERROR = "\u53d1\u751f\u4e86\u9519\u8bef\u3002\u8bf7\u91cd\u8bd5\u6b64\u64cd\u4f5c\u3002\u5982\u679c\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8bbf\u95ee 金蟾•展会CRM \u793e\u533a\u4ee5\u83b7\u53d6\u89e3\u51b3\u65b9\u6848\u6216\u8005\u4e0e\u60a8\u6240\u5728\u7ec4\u7ec7\u7684 金蟾•展会CRM \u7ba1\u7406\u5458\u8054\u7cfb\u3002\u6700\u540e\uff0c\u60a8\u53ef\u4ee5\u4e0e Microsoft \u652f\u6301\u8054\u7cfb\u3002";

    //action
    var LOCID_NO_ASTERISK="搜索字段不得包含星号 (*) 字符。请移除任何使用过的字符，然后重试。";

    //Grid
    var LOCID_GRID_SELECT_ALL_KEY = "A";
    var LOCID_LOADING_GRID_DATA ="Loading Data...";
    var LOCID_REFRESH_GRID_CANCELLED ="刷新已取消。";
    var LOCID_LOADING_GRID_FAILED ="网格刷新失败。";
    var LOCID_ALT_COLUMNSORTORDER_DOWN ="数据按降序存储在该列中";
    var LOCID_ALT_COLUMNSORTORDER_UP ="数据按升序存储在该列中";
    
    /* 自定义排序 */
    var LOCID_VARIABLE_FILTER="flipv()"; //刷新前状态
    var LOCID_VARIABLE_FIELDNAME=""; //所选列列名
    var LOCID_VARIABLE_FIELD=""; //排序字段
    var LOCID_VARIABLE_LEVEL=""; //排序级别
    var LOCID_VARIABLE_OLDFIELDNAME="";
    
    var WEB_APP_URL = "";
    var HELP_SKU = "OP";
    var IS_LIVE = false;
    var IS_PATHBASEDURLS = true;
    var ORG_UNIQUE_NAME = "ruisy";
    var _ErrorCodesIsvAborted = "0x80040265";
    var ScriptErrorReportingPreference = 1;
    var ScriptErrorStatusBar = "\u7f51\u9875\u4e0a\u6709\u9519\u8bef\u3002";
    var _bPresenceEnabled = true;
    var ORG_DATE_FORMATSTRING = "yyyy\x2fM\x2fd";
    var ORG_IS_GREGORIANCALENDAR = false;
    var ORG_DATE_SEPARATOR = "-";
    var ORG_DATE_START_DAY = 0;
    var ORG_LANGUAGE_CODE = 2052;
    var ORG_NUMBER_FORMAT_MASK = "\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";
    var ORG_TIME_FORMAT = 0;
    var ORG_SHOW_WEEK_NUMBER = false;
    var ORG_NUMBER_DECIMAL_SEPARATOR = ".";
    var ORG_NUMBER_GROUP_SEPARATOR = ",";
    var AUTHENTICATION_TYPE = 0;
    var ORG_TIMEZONE_OFFSET = 480;
    var USER_DATE_FORMATSTRING = "yyyy\x2fM\x2fd";
    var USER_IS_GREGORIANCALENDAR = true;
    var USER_DATE_SEPARATOR = "-";
    var USER_DATE_FORMATTED_FORMATSTRING = "yyyy\x2fM\x2fd";
    var DEFAULT_USER_NUMBER_FORMAT_MASK = "\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";
    var USER_LANGUAGE_CODE = 2052;
    var USER_HELP_LCID = "2052";
    var USER_NUMBER_FORMAT_MASK = "\x23,\x23\x230.\x2a\x3b\x7e\x23,\x23\x230.\x2a";
    var USER_TIME_FORMAT = "H\x3amm";
    var USER_SHOW_WEEK_NUMBER = false;
    var USER_NUMBER_DECIMAL_SEPARATOR = ".";
    var USER_NUMBER_GROUP_SEPARATOR = ",";
    var HELP_SERVER_URL = "";
    </script>

    <script type="text/javascript" src="../_static/_common/scripts/encodedecode.js"></script>

    <script type="text/javascript" src="../_static/_controls/util/util.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/global.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/xmlutil.js"></script>

    <script type="text/javascript" src="../_static/_controls/remotecommands/remotecommand.js"></script>

    <script type="text/javascript" src="../_common/windowinformation/windowinformation.js"></script>

    <script type="text/javascript" src="../_static/_common/scripts/presence.js"></script>

    <script type="text/javascript" src="../_static/_controls/lookup/lookup.js"></script>

    <script type="text/javascript" src="../_static/_grid/action.js"></script>

    <script type="text/javascript" src="../_static/_forms/addrelated.js"></script>
    
    <script type="text/javascript" src="../_static/_controls/lookup/lookupdialogsappgrid.js"></script>
    <script type="text/javascript" src="../_static/_jQuery/jquery-1.3.2.min.js"></script>

    <link rel="stylesheet" type="text/css" href="../_common/styles/global.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/global-styles.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/global-dynamic-styles.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/fonts.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/addusers.css" />
    <link rel="stylesheet" type="text/css" href="../_forms/controls/controls.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/select.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/dialogs.css" />
    <link rel="stylesheet" type="text/css" href="../_controls/lookup/lookupdialogs.css" />
    <link rel="stylesheet" type="text/css" href="../_common/styles/wizardform.css" />
    <link rel="stylesheet" type="text/css" href="../_grid/appgrid.css" />

    <script language="javascript" type="text/javascript">

    function applychanges()
    {
        selectItem();
    }

    function cancel()
    {
        window.close();
    }

    function window.onload()
    {
        LoadingData();
	}
    function LoadingData()
    {
        $.ajax({
               type:    "POST",
               url:     "dlg_role.aspx",
               data:    {
                        otype:         "loaddata"
               },
               beforeSend:function(){
                    $("#divloading").css("display","block");
                    $("#divItemsList").html('');
               },
               success: function(res, textStatus){
                    $("#divloading").css("display","none");
                    $("#divItemsList").html(res);
               }
          }); 
    }
    function handlePropertiesBtn()
    {
        butBegin.disabled = btnProperties.disabled = !(crmGrid.InnerGrid.SelectedRecords.length >=1)
    }

    function handleDblClick()
    {
        selectItem();
        event.returnValue = false;
    }

    function selectItem()
    {
        var oTrs = getSelectedOTrs("crmGrid");
        if(oTrs)
        {
            var arrRoles = "";
            for (var i = 0; i < oTrs.length; i++)
            {
                arrRoles += oTrs[i][3].oid;
                arrRoles += ",";
            }
            if(arrRoles != "")
            {
                arrRoles += "|";
                arrRoles = arrRoles.replace(",|", "");
            }
            if(arrRoles != "")
            {
                $.post(
                   "dlg_role.aspx",
                   {    
                        otype:          'addroles',
                        systemuserid:   Trim(GetQueryString("systemuserid")),
                        arrroles:       arrRoles
                   },
                   function(res){        
                        if (res == "succeeded")
                        {
                            alert("用户组设置成功！");
                            window.dialogArguments.document.getElementById("RefreshItems").click();
                            window.close(); 
                        }
                        else
                            alert(res);
                   }
                );
             }
            else
            {
                alert("请先选中记录!");
            }
        }
        else
        {
            alert("请先选中记录!");
        }
    }
    </script>

</head>
<body>
    <form id="crmForm" name="crmForm" runat="server">
        <table class="stdTable" cellspacing="0" cellpadding="0">
            <tbody>
                <tr>
                    <td class="ms-crm-WizardForm-Header">
                        <table class="ms-crm-WizardForm-Header" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr>
                                    <td class="ms-crm-WizardForm-Header-Title">
                                        <span class="ms-crm-WizardForm-Header-Title" id="spanTitle">添加用户组</span><span id="spanPageNumber"></span></td>
                                    <td class="ms-crm-WizardForm-Header-Help">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="ms-crm-WizardForm-Main">
                            <table height="100%" cellspacing="0" cellpadding="0" width="100%">
                                <tbody>
                                    <tr>
                                        <td>
                                            <table id="tblFind" height="100%" cellspacing="0" cellpadding="0" width="100%">
                                                <tbody>
                                                    <tr>
                                                        <td colspan="3">
                                                            <div id="divloading" style="display: none;">
                                                                <table class="stdTable" style="background-color: #FFFFFF; border: solid 1px #6699CC;"
                                                                    cellpadding="0" cellspacing="0">
                                                                    <tr>
                                                                        <td style="vertical-align: middle" align="center">
                                                                            <img src="../_imgs/AdvFind/progress.gif" /><br />
                                                                            加载数据 ...</td>
                                                                    </tr>
                                                                </table>
                                                            </div>
                                                            <div id="divItemsList">
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="ms-crm-WizardForm-Footer">
                        <button class="ms-crm-Button" id="butBegin" onclick="applychanges();">
                            确定</button>&nbsp;
                        <button class="ms-crm-Button" id="cmdDialogCancel" onclick="cancel();">
                            取消</button></td>
                </tr>
            </tbody>
        </table>
    </form>
</body>
</html>
